using Quiki.ExpressionParsers;

namespace Quiki.DocumentPostprocessors
{
    public class CategoriesScooper : IDocumentPostprocessor
    {
        public void PostProcessDocument(WikiDocument document)
        {
            document.RootElement.ForEachElement (
                x => x.ElementType == WikiTextElementType.InternalLink && ((WikiInternalLinkElement)x).Reference.IsCategory,
                x => document.Categories.Add (((WikiInternalLinkElement)x).Reference.Parts[1]));
        }
    }
}